package fuxi01_lombok_override_array_20250707.jicheng_yinHangCunQianQuQian;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor

public class Bank {
//    余额
    private long bank_balance=0;

//    判断是否可以取款
    private boolean isFlag(long money){
        if (bank_balance>=money){
            return true;
        }
        else {
            return false;
        }
    }

    public void cunkuan(long money){
        bank_balance += money;
        System.out.println("存款成功，余额："+bank_balance);
    }

    public void qukuan(long money){
        if (isFlag(money)){
            bank_balance -= money;
            System.out.println("取款成功，余额："+bank_balance);
        }
        else {
            System.out.println("余额不足");
        }
    }

    public void menu(){
        System.out.println("请输入需要办理的业务：");
        System.out.println("1：存款");
        System.out.println("2：取款");
        System.out.println("3：查询余额");
    }
}


